//
// Created by zhupi on 2024/9/5.
//

#include "gallery_desktop.h"
#include <QVBoxLayout>
#include "gallery/base_cell/gallery_base_cell_widget.h"
GalleryDesktop::GalleryDesktop(QWidget *parent) {

}

void GalleryDesktop::Initial() {
    InitWidget();
}

void GalleryDesktop::InitWidget() {

    QHBoxLayout *vbox = new QHBoxLayout;
    vbox->setSpacing(0); // 设置布局内的控件之间的间距为0，确保没有额外空隙


    QWidget *panelContainer1 = new QWidget(this);
    QVBoxLayout *containerLayout1 = new QVBoxLayout(panelContainer1);
    IconPanel *panel = new IconPanel(this);

// 创建一些QAction
    QAction *largeAction = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\shape.png"), "大图标", this);
    QAction *mediumAction = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\shape.png"), "中图标", this);
    QAction *smallAction = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\file-open.png"), "小图标", this);

    QAction *smallAction1 = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\file-open.png"), "小图标", this);
    QAction *smallAction2 = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\shape.png"), "小图标", this);
    QAction *smallAction3 = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\file-open.png"), "小图标", this);

    QAction *smallAction4 = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\shape.png"), "小图标", this);
    QAction *smallAction5 = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\shape.png"), "小图标", this);
// 添加不同大小的Action到panel
    panel->AddLargeAction(largeAction);
    panel->AddSmallAction(smallAction);
    panel->AddMediumAction(mediumAction);

    panel->AddSmallAction(smallAction1);
    panel->AddSmallAction(smallAction2);
    panel->AddSmallAction(smallAction3);

    panel->AddSmallAction(smallAction4);
    panel->AddLargeAction(smallAction5);

// 添加分割线和弹簧到布局的最后
    panel->FinalizeLayout();
    // ----------------------------------------------------------
    IconPanel *panel1 = new IconPanel(this);
    QAction *test1 = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\shape.png"), "小图标", this);
    QAction *test2 = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\shape.png"), "小图标", this);
    QAction *test3 = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\shape.png"), "小图标", this);
    QAction *test4 = new QAction(QIcon("C:\\Users\\zhupi\\OneDrive\\桌面\\work\\shape.png"), "小图标", this);

    panel1->AddSmallAction(test1);
    panel1->AddLargeAction(test2);
    panel1->AddSmallAction(test4);
    panel1->AddSmallAction(test3);

    panel1->FinalizeLayout();


    vbox->addWidget(panel);
    vbox->addWidget(panel1);
    vbox->setContentsMargins(0, 0, 0, 0); // 确保没有额外的边距
    vbox->addStretch();
    this->setLayout(vbox);

}
